﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Horridor
{
    class DrawableObject
    {
        protected Texture2D texture;
        protected Vector2 originPos;
        protected Rectangle drawRectangle;

        protected Rectangle getDrawrectangle()
        {
            return new Rectangle((int)(originPos.X - (drawRectangle.Width / 2)), (int)(originPos.Y - (drawRectangle.Height / 2)), drawRectangle.Width, drawRectangle.Height);
        }

        public DrawableObject(Texture2D Texture)
        {
            texture = Texture;
            drawRectangle.Width = texture.Width;
            drawRectangle.Height = texture.Height;
        }

        public DrawableObject(Texture2D Texture, float x , float y)
        {
            texture = Texture;
            drawRectangle.Width = texture.Width;
            drawRectangle.Height = texture.Height;
            setPos(x, y);
        }

        public void setPos(float x, float y)
        {
            originPos = new Vector2(x - (drawRectangle.Width / 2), y - (drawRectangle.Height / 2));
        }

        public void Draw(SpriteBatch batchy)
        {
            batchy.Draw(texture, getDrawrectangle(), Color.White);
        }

        public void Update(int ems)
        { }
    }
}
